using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using BoOnce.GameLogic.Entities.Drawable.Scenery;
using BoOnce.Components;

namespace BoOnce.GameLogic.Entities
{
    class Background : Scenery
    {
        BackgroundBehaviour _Behaviour;

        private Texture2D _Background;

        public Vector2 Position;

        float _Coeff;

        public Background(Texture2D background,BackgroundBehaviour b, float coeff ) 
        {
            _Behaviour = b;
            Position = Vector2.Zero;
            _Background = background;
            _Coeff = coeff;
        }

        public float Width
        {
            get
            {
                return _Background.Width;
            }
        }

        public float Height
        {
            get
            {
                return _Background.Height;
            }
        }

        public override void QuickDraw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            switch(_Behaviour)
            {
                case BackgroundBehaviour.FOLLOW_CAMERA:
                    spriteBatch.Draw(_Background, Position, Color.White);
                    break;

                case BackgroundBehaviour.STAY:
                    spriteBatch.Draw(_Background, Camera.ToScreenPosition(Position), Color.White);
                    break;

                case BackgroundBehaviour.SLOW:
                    Vector2 pos = Camera.ToScreenPosition(Position);
                    pos.X *= _Coeff;
                    spriteBatch.Draw(_Background, pos, Color.White);
                    break;                                
            }
        }

        public override void Update(GameTime gameTime)
        {
            //DEC.Add(this);
        }

    }
}
